<%-------------------------------------------------------------------
 * 页面名称：batchTransAuditManage.jsp
 * 功能描述：批量支付审核
 * Action: 
 *
 *-------------------------------------------------------------------
--%>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ page import="cn.agiledata.bank.common.util.Constant"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-bean.tld" prefix="bean"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="ipb" uri="/WEB-INF/conf/tld/ipb.tld"%>
<%@ taglib prefix="ad" uri="agiledata"%>
<%
    String path = request.getContextPath();
%>
<link href="<%=path%>/css/style.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/css/newstyle.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/css/common.css" rel="stylesheet" type="text/css" />
<script type='text/javascript' src='<%=path%>/dwr/util.js'></script>
<script type='text/javascript' src='<%=path%>/js/ufront.js'></script>
<script type='text/javascript' src='<%=path%>/dwr/engine.js'></script>
<script language=javascript src="<%=path%>/js/vnv/commonForManage.js"></script>
<script language=javascript src="<%=path%>/js/popcalendar.js"></script>
<script type='text/javascript' src='<%=path%>/dwr/interface/accountTemplate.js'></script>
<script type='text/javascript' src='<%=path%>/js/vnv/commonForManage.js'></script>
<script language="JavaScript" type="text/JavaScript">
function validate(){
    var amountMin = document.forms[0].amountMin;
    var amountMax = document.forms[0].amountMax;
    if(parseFloat(amountMin.value)>parseFloat(amountMax.value)){
        alert("您输入的最小金额大于最大金额！");
        return false;
    }
    if(isNaN(amountMin.value)){
        alert('您输入的最小金额不正确，请重新输入');
        amountMin.value = "";
        amountMin.focus();
        return false;
    }
    if(isNaN(amountMax.value)){
        alert('您输入的最大金额不正确，请重新输入');
        amountMax.value = "";
        amountMax.focus();
        return false;
    }
    return true;
}
function doSubmit(){
    if(validate()){
        document.forms[0].submit();
    }
}

function changeBatchType(batchType){
    <logic:equal name="transStatus" value="<%=Constant.ES_TRANS_STATUS_REJECTED%>">
        document.forms[0].action = "<%=path%>/page/transaction/auditRejectList.do";
    </logic:equal>
    <logic:equal name="transStatus" value="<%=Constant.ES_TRANS_STATUS_UNAUDIT%>">
        document.forms[0].action = "<%=path%>/page/transaction/waitingAuditList.do";
    </logic:equal>
    <logic:equal name="transStatus" value="<%=Constant.ES_TRANS_STATUS_UNPAY%>">
        document.forms[0].action = "<%=path%>/page/transaction/waitingPayList.do";
    </logic:equal>
        document.forms[0].batchType.value = batchType+"";
        document.forms[0].submit();
}

function returnReject(batchType){
        document.forms[0].action = "<%=path%>/page/transaction/auditRejectList.do";
        document.forms[0].batchType.value = batchType+"";
        document.forms[0].submit();
    
}
function batchAudit(type){
		if(getObj('attitude').value.length>30){
				alert("您填写的处理意见过长，请重新填写！");
				getObj('attitude').value="";
				getObj('attitude').focus();
				return;
		}
        if(type == 'Y'){
            if(document.getElementById('attitude').value.length<1){
                document.getElementById('attitude').value = '同意';
            }
        }else{
            if(document.getElementById('attitude').value.length<1){
                alert("请输入处理意见！");
                return;
            }
        }
            
        document.getElementById('audit').value=type;
        
        document.getElementById('viewBatchNo').value='<bean:write name="totalSummary" property="batchNo" />';
        document.forms[0].action='batchAudit.do';
        if(type == 'Y'){
            if(confirm('您确定需要批量同意么？')){
              document.forms[0].submit();
            }
        }else{
            if(confirm('您确定需要批量拒绝么？')){
              document.forms[0].submit();
            }
        }
        document.forms[0].attitude.value = "";
}   
function batchRejectManage(){
document.getElementById('viewBatchNo').value='<bean:write name="totalSummary" property="batchNo" />';
if(confirm('您确定需要批量重审么？')){
    document.forms[0].action='batchAuditRejectManage.do';
    document.forms[0].submit();
    }
}

</script>
<html:form action="toWaitPay">
<html:hidden property="transStatus" />
<html:hidden property="batchType" />
<input type="hidden" name="audit" value="Y" />
<input type="hidden" name="viewBatchNo" value="" />
<div id="main">
  <div class="content_right">
  <div style="width:745px;margin-left:10px;">
    <div class="titleinfo">
    <logic:notEmpty name="transStatus">
      <ad:TypeChange typeId="ES_PRE_PAY_TRANS_STATUS"><bean:write name="transStatus" /></ad:TypeChange>
      </logic:notEmpty>批量交易
    </div>
    <div class="edit_pass"> 
      <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
        <tr>
          <td width="25%" align="right" bgcolor="#FFFFFF">批次号：</td>
          <td width="25%" class="fontgraydrop14"><bean:write name="totalSummary" property="batchNo" /></td>
          <td width="25%" align="right" bgcolor="#FFFFFF" class="font_blue"><span class="qzt">付款子账户</span>：</td>
          <td width="25%" class="fontgraydrop14">
                <logic:empty name="totalSummary" property="debit.account.name">
		          <logic:empty name="totalSummary" property="debit.account.email">
		              <bean:write name="totalSummary" property="debit.account.mobile" />
		          </logic:empty>
		          <logic:notEmpty name="totalSummary" property="debit.account.email">
		              <bean:write name="totalSummary" property="debit.account.email" />
		          </logic:notEmpty>
		      </logic:empty>
		      <logic:notEmpty name="totalSummary" property="debit.account.name">
		          <bean:write name="totalSummary" property="debit.account.name" />
		      </logic:notEmpty>
		       的
		      <bean:write name="totalSummary" property="debit.accountName" />
        </td>
        </tr>
        <tr>
          <td align="right" bgcolor="#FFFFFF">交易类型：</td>
          <td class="fontgraydrop14"><bean:write name="totalSummary" property="actionType.actionName" /></td>
          <td align="right" bgcolor="#FFFFFF">交易开始时间：</td>
          <td class="fontgraydrop14"><bean:write name="totalSummary" property="beginDate" format="yyyy-MM-dd HH:mm" /></td>
        </tr>
        <tr>
          <td align="right" bgcolor="#FFFFFF">交易取消笔数：</td>
          <td class="fontgraydrop14">
          <logic:present name="cancelSummary">
	          <bean:write name="cancelSummary" property="statusCount" />
	      </logic:present>
	      <logic:notPresent name="cancelSummary">0</logic:notPresent>
          </td>
          <td align="right" bgcolor="#FFFFFF" class="font_blue"><span class="qzt">审核失败笔数：</span></td>
          <td class="fontgraydrop14">
          <logic:present name="rejectedSummary">
	          <bean:write name="rejectedSummary" property="statusCount" />
	      </logic:present>
	      <logic:notPresent name="rejectedSummary">0</logic:notPresent>
          </td>
        </tr>
        <tr>
          <td align="right" bgcolor="#FFFFFF">待审核笔数：</td>
          <td class="fontgraydrop14">
          <logic:present name="unauditSummary">
	          <bean:write name="unauditSummary" property="statusCount" />
	      </logic:present>
	      <logic:notPresent name="unauditSummary">0</logic:notPresent>
          </td>
          <td align="right" bgcolor="#FFFFFF" class="font_blue">待支付笔数：</td>
          <td class="fontgraydrop14">
          <logic:present name="unpaySummary">
	          <bean:write name="unpaySummary" property="statusCount" />
	      </logic:present>
	      <logic:notPresent name="unpaySummary">0</logic:notPresent>
          </td>
        </tr>
        <tr>
          <td align="right" bgcolor="#FFFFFF">总笔数：</td>
          <td class="fontgraydrop14"><bean:write name="totalSummary" property="totalCount" /></td>
          <td align="right" bgcolor="#FFFFFF" class="font_blue">总金额：</td>
          <td class="fontgraydrop14"><span id="debitSubAccountBalanceSpan" class="orangefont14b">
          <ad:FormatPrase>
	          <bean:write name="totalSummary" property="totalAmountWithFee" />
	      </ad:FormatPrase></span>
	       元
          </td>
        </tr>
        <tr>
          <td align="right" bgcolor="#FFFFFF">需要支付金额：</td>
          <td class="fontgraydrop14"><span id="debitSubAccountBalanceSpan" class="orangefont14b">
          <ad:FormatPrase>
          <logic:present name="unpaySummary">
              <bean:write name="unpaySummary" property="statusAmountWithFee" />
          </logic:present>
          <logic:notPresent name="unpaySummary">0.00</logic:notPresent>
	      </ad:FormatPrase></span>
	       元
          </td>
          <logic:equal name="transStatus" value="<%=Constant.ES_TRANS_STATUS_UNAUDIT%>">
          <td align="right" bgcolor="#FFFFFF" class="font_blue">审核意见：</td>
          <td bgcolor="#FFFFFF"><span class="qzt"><input class="inputStyle" type="text" name="attitude" /></span>
          </td>
          </logic:equal>
          <logic:notEqual name="transStatus" value="<%=Constant.ES_TRANS_STATUS_UNAUDIT%>">
          <td align="right" bgcolor="#FFFFFF" class="font_blue"></td>
          <td bgcolor="#FFFFFF"></td>
          </logic:notEqual>
        </tr>
        <tr>
          <td colspan="4" align="right" bgcolor="#FFFFFF"><hr size="1" style="color:#88A7C0;"/></td>
        </tr>
        <tr>
          <td colspan="4" align="center" bgcolor="#FFFFFF"><span class="button_Frame">
            　<logic:equal name="transStatus" value="<%=Constant.ES_TRANS_STATUS_REJECTED%>">
		      <logic:equal name="requiredBatchManage" value="true">
		        <input type="button" value=" 批量提交重审" class="graybutton_stylelong" onclick="batchRejectManage()" />
		      </logic:equal>
		      <logic:notEqual name="requiredBatchManage" value="true">
		        <input type="button" value=" 批量提交重审" class="graybutton_stylelong" disabled="disabled" />
		      </logic:notEqual>
		    </logic:equal>
		    <logic:equal name="transStatus" value="<%=Constant.ES_TRANS_STATUS_UNAUDIT%>">
		      <logic:equal name="ifBatchAudit" value="true">
		        <input type="button" value="批量同意" class="graybutton_stylelong" onclick="batchAudit('Y')"/>
		        <input type="button" value="批量拒绝" class="graybutton_stylelong" onclick="batchAudit('N')"/>
		      </logic:equal>
		      <logic:notEqual name="ifBatchAudit" value="true">
		        <input type="button" value="批量同意" class="graybutton_stylelong" disabled="disabled"/>
		        <input type="button" value="批量拒绝" class="graybutton_stylelong" disabled="disabled"/>
		      </logic:notEqual>
		    </logic:equal>
            </span></td>
        </tr>
      </table>
      <br />
    <table width="100%" class="tablestyle">
      <tr>
        <th><span class="blue14">批次号</span></th>
        <th><span class="blue14">交易编号</span></th>
        <th><span class="blue14">交易子账户</span></th>
        <th><span class="blue14">交易对方</span></th>
        <th><span class="blue14">交易类型</span></th>
        <th><span class="blue14">交易时间</span></th>
        <th><span class="blue14">金额</span></th>
        <th><span class="blue14">操作</span></th>
        <logic:equal name="transStatus" value="<%=Constant.ES_TRANS_STATUS_REJECTED%>">
        <th><span class="blue14">取消</span></th>
        </logic:equal>
        </tr>
        <c:forEach var="id" items="${waitPayList.data}" varStatus="status">
        <tr>
        <td><bean:write name="id" property="batchNo" /></td>
        <td>
            <logic:notEmpty name="transStatus">
                <a class="menuTextBlue" href="<%=path%>/page/transaction/esPerPayTransPayDetail.do?transactionID=<bean:write name="id" property="id"/>">
                    <bean:write name="id" property="transId" />
                </a>
            </logic:notEmpty>
        </td>
        <td><bean:write name="id" property="debit.accountName" /></td>
        <td>
            <logic:equal name="id" property="actionType.id" value="3">
                <a class="menuTextBlue" href="<%=path%>/page/common/getAccount.do?accountId=<bean:write name="id" property="credit.account.id"/>">
                    <bean:write name="id" property="creditName" />
                </a>
            </logic:equal>
            <logic:notEqual name="id" property="actionType.id" value="3">
                <bean:write name="id" property="credit.account.name" />
            </logic:notEqual>
        </td>
        <td><bean:write name="id" property="actionType.actionName" /></td>
        <td><bean:write name="id" property="updateTime" format="yyyy-MM-dd HH:mm" /></td>
        <td><bean:write name="id" property="amount" format="#0.00" /></td>
        <td>
            <logic:equal name="id" property="transStatus" value="<%=Constant.ES_TRANS_STATUS_UNPAY%>">
                <a class="menuTextBlue" href="<%=path%>/page/transaction/esPerPayTransPayDetail.do?type=1&transactionID=<bean:write name="id" property="id"/>">支付</a>
            </logic:equal>
            <logic:equal name="id" property="transStatus" value="<%=Constant.ES_TRANS_STATUS_REJECTED%>">
                <a class="menuTextBlue" href="<%=path%>/page/transaction/esPerPayTransPayDetail.do?type=1&transactionID=<bean:write name="id" property="id"/>">操作</a>
            </logic:equal>
            <logic:equal name="id" property="transStatus" value="<%=Constant.ES_TRANS_STATUS_UNAUDIT%>">
              <logic:equal name="id" property="audit" value="true">
                <a class="menuTextBlue" href="<%=path%>/page/transaction/esPerPayTransPayDetail.do?type=1&transactionID=<bean:write name="id" property="id"/>">审核</a>
              </logic:equal>
            </logic:equal>
        </td>
        <logic:equal name="transStatus" value="<%=Constant.ES_TRANS_STATUS_REJECTED%>">
        <td>
            <a class="menuTextBlue" href="#" onclick="if (confirm('您确定要取消此交易吗？')) location.href='<%=path%>/page/transaction/esPerPayTransPayDel.do?batchType=true&transactionID=<bean:write name="id" property="id"/>&oldStatus=<%=Constant.ES_TRANS_STATUS_REJECTED%>';">取消</a>
        </td>
        </logic:equal>
      </tr>
      </c:forEach>
      </table>
        <table width="100%" height="30" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td height="25" align="center" class="font_blue"><ad:PageBean name="waitPayList" goImage="${pageContext.request.contextPath}/images/go_button.gif"/></td>
          </tr>
      </table>
    </div></div>
</div>
</div>
</html:form>